# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=git-interactive-rebase-tool
pkgver=2.2.0
pkgrel=0
pkgdesc="A terminal based sequence editor for interactive rebase"
url="https://gitrebasetool.mitmaro.ca"
arch="all !s390x !riscv64" # limited by rust/cargo
license="GPL-3.0-or-later"
makedepends="cargo libgit2-dev zlib-dev"
subpackages="$pkgname-doc"
source="https://github.com/MitMaro/git-interactive-rebase-tool/archive/$pkgver/$pkgname-$pkgver.tar.gz"

export CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1
export CARGO_PROFILE_RELEASE_LTO="true"
export CARGO_PROFILE_RELEASE_OPT_LEVEL="z"
export CARGO_PROFILE_RELEASE_PANIC="abort"

prepare() {
	default_prepare

	cargo fetch --locked
}

build() {
	cargo build --frozen --release
}

check() {
	cargo test --frozen
}

package() {
	install -D -m755 target/release/interactive-rebase-tool -t "$pkgdir"/usr/bin/

	install -D -m 644 src/interactive-rebase-tool.1 \
		"$pkgdir"/usr/share/man/man1/interactive-rebase-tool.1
}

sha512sums="
4aec9b5e7462bc95b7e45e8aae195537a9c8ae37c2bac07370cbe95979fa81d5f48ab3b130d9613517498b961e7755c0925033d7cbeec560b394756686a4da61  git-interactive-rebase-tool-2.2.0.tar.gz
"
